#include "cpu/exec/template-start.h"

make_helper(ret){
	cpu.eip = swaddr_read(reg_l(R_ESP), 4,R_SS) - 1;//先更新eip为返回call前的地址加偏移
	cpu.esp += 4;//回收栈空间
	print_asm("ret");
	return 1;
}

make_helper(ret_i){
	uint16_t i = instr_fetch(eip + 1 , 2);//ret2字节立即数
	cpu.eip = swaddr_read(cpu.esp, 4,R_SS) - 3;//更新eip，且ss
	cpu.esp = cpu.esp + 4 + i;
	print_asm("ret $0x%x", i);
	return 3;
}

#include "cpu/exec/template-end.h"